//
//  XRRefreshFooter.m
//  LandCredit
//
//  Created by 段新瑞 on 2017/4/19.
//  Copyright © 2017年 联壁. All rights reserved.
//

#import "XRRefreshFooter.h"

@implementation XRRefreshFooter

- (void)prepare {
    
    [super prepare];
    
    // 隐藏刷新状态的文字
    self.refreshingTitleHidden = NO;
    
    // 禁止自动加载
    self.automaticallyRefresh = YES;
    
    // 设置文字
    [self setTitle:@"松开加载" forState:MJRefreshStateIdle];
    [self setTitle:@"正在加载" forState:MJRefreshStateRefreshing];
    [self setTitle:@"没有跟多数据" forState:MJRefreshStateNoMoreData];
    [self setTitle:@"" forState:MJRefreshStateNoMoreData];
    
    // 设置字体
//    self.stateLabel.font = [UIFont systemFontOfSize:17];
    
    // 设置颜色
//    self.stateLabel.textColor = [UIColor blueColor];
    
    // 根据拖拽比例自动切换透明度
//    self.automaticallyChangeAlpha = NO;
    
    
    /*
     // 设置普通状态的动画图片
     NSMutableArray *idleImages = [NSMutableArray array];
     for (NSUInteger i = 1; i<=60; i++) {
     UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"dropdown_anim__000%zd", i]];
     [idleImages addObject:image];
     }
     [self setImages:idleImages forState:MJRefreshStateIdle];
     
     // 设置即将刷新状态的动画图片（一松开就会刷新的状态）
     NSMutableArray *refreshingImages = [NSMutableArray array];
     for (NSUInteger i = 1; i<=3; i++) {
     UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"dropdown_loading_0%zd", i]];
     [refreshingImages addObject:image];
     }
     [self setImages:refreshingImages forState:MJRefreshStatePulling];
     
     // 设置正在刷新状态的动画图片
     [self setImages:refreshingImages forState:MJRefreshStateRefreshing];
     */
    
}

#pragma mark 在这里设置子控件的位置和尺寸
- (void)placeSubviews {
    [super placeSubviews];
}

#pragma mark 监听scrollView的contentOffset改变
- (void)scrollViewContentOffsetDidChange:(NSDictionary *)change {
    [super scrollViewContentOffsetDidChange:change];
    
}

#pragma mark 监听scrollView的contentSize改变
- (void)scrollViewContentSizeDidChange:(NSDictionary *)change {
    [super scrollViewContentSizeDidChange:change];
    
}

#pragma mark 监听scrollView的拖拽状态改变
- (void)scrollViewPanStateDidChange:(NSDictionary *)change {
    [super scrollViewPanStateDidChange:change];
    
}

#pragma mark 监听控件的刷新状态
- (void)setState:(MJRefreshState)state {
    [super setState:state];
}

@end
